//路由全局守卫
import router from "./router"
import nprogress from "nprogress"
import "nprogress/nprogress.css"
import { useCounterStore } from '@/stores/counter'


const store = useCounterStore()
router.beforeEach((to, from, next) => {
    nprogress.start()
    if (to.path === "/login") {
        if (store.token) {
            next("/")
        }
        next()
    } else {
        if (store.token) {
            next()
        } else {
            next("/login")
        }
    }
    nprogress.done()
})

router.afterEach((to, from) => {
})